package com.xjtu.platform.security.register.dao;

import com.xjtu.platform.security.register.RegisterDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface RegisterDao {

    @Insert("insert into user(user_age,user_id,user_name,user_pwd) values(#{dto.user_age},#{dto.user_id},#{dto.user_name},#{dto.user_pwd})")
    void insertUser(@Param("dto") RegisterDto registerDto, @Param("role") String role);

    @Select("select role from human where id=#{user_ident}")
    String getRole(RegisterDto registerDto);

    @Insert("insert into user_role values(#{count},#{dto.user_id},#{role})")
    void insertRole(@Param("dto") RegisterDto registerDto, @Param("role") String role,@Param("count") int count);

    @Select("select count(user_role_id) from user_role")
    int getCount();
}
